﻿using System;
using AutoR.Services;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using Prism.Services;
using Xamarin.Forms;

namespace AutoR.ViewModels.Home
{
	// Token: 0x020000A8 RID: 168
	public class BuildViewModel : BindableBase, INavigationAware, INavigatedAware, INavigatingAware
	{
		// Token: 0x170000D1 RID: 209
		// (get) Token: 0x0600032E RID: 814 RVA: 0x00048CFA File Offset: 0x00046EFA
		private INavigationService NavigationService { get; }

		// Token: 0x170000D2 RID: 210
		// (get) Token: 0x0600032F RID: 815 RVA: 0x00048D02 File Offset: 0x00046F02
		private IPageDialogService PageDialogService { get; }

		// Token: 0x170000D3 RID: 211
		// (get) Token: 0x06000330 RID: 816 RVA: 0x000408F6 File Offset: 0x0003EAF6
		public GameData Game
		{
			get
			{
				return Runtime.Game;
			}
		}

		// Token: 0x170000D4 RID: 212
		// (get) Token: 0x06000331 RID: 817 RVA: 0x00048D0A File Offset: 0x00046F0A
		public DelegateCommand BuildCommand { get; }

		// Token: 0x170000D5 RID: 213
		// (get) Token: 0x06000332 RID: 818 RVA: 0x00048D12 File Offset: 0x00046F12
		public DelegateCommand EquipBuildCommand { get; }

		// Token: 0x170000D6 RID: 214
		// (get) Token: 0x06000333 RID: 819 RVA: 0x00048D1A File Offset: 0x00046F1A
		public DelegateCommand WebCommand { get; }

		// Token: 0x06000334 RID: 820 RVA: 0x00048D24 File Offset: 0x00046F24
		public BuildViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
		{
			this.NavigationService = navigationService;
			this.PageDialogService = pageDialogService;
			this.WebCommand = new DelegateCommand(delegate()
			{
				Device.OpenUri(new Uri("https://zh.moegirl.org/zh-hans/%E6%88%98%E8%88%B0%E5%B0%91%E5%A5%B3/%E5%BB%BA%E9%80%A0"));
			});
			this.BuildCommand = new DelegateCommand(async delegate()
			{
				string a = await this.PageDialogService.DisplayActionSheetAsync("建造公式", "取消", null, new string[]
				{
					"航母|装母 500 130 600 300",
					"战列|战巡 400 80 650 130",
					"潜艇 30 30 60 30",
					"小船 200 30 200 30"
				});
				if (!(a == "航母|装母 500 130 600 300"))
				{
					if (!(a == "战列|战巡 400 80 650 130"))
					{
						if (!(a == "潜艇 30 30 60 30"))
						{
							if (a == "小船 200 30 200 30")
							{
								this.Game.OthersConfig.ShipOil = 200;
								this.Game.OthersConfig.ShipAmmo = 30;
								this.Game.OthersConfig.ShipSteel = 200;
								this.Game.OthersConfig.ShipAluminium = 30;
							}
						}
						else
						{
							this.Game.OthersConfig.ShipOil = 30;
							this.Game.OthersConfig.ShipAmmo = 30;
							this.Game.OthersConfig.ShipSteel = 60;
							this.Game.OthersConfig.ShipAluminium = 30;
						}
					}
					else
					{
						this.Game.OthersConfig.ShipOil = 400;
						this.Game.OthersConfig.ShipAmmo = 80;
						this.Game.OthersConfig.ShipSteel = 650;
						this.Game.OthersConfig.ShipAluminium = 130;
					}
				}
				else
				{
					this.Game.OthersConfig.ShipOil = 500;
					this.Game.OthersConfig.ShipAmmo = 130;
					this.Game.OthersConfig.ShipSteel = 600;
					this.Game.OthersConfig.ShipAluminium = 300;
				}
			});
			this.EquipBuildCommand = new DelegateCommand(async delegate()
			{
				string a = await this.PageDialogService.DisplayActionSheetAsync("建造公式", "取消", null, new string[]
				{
					"通用 100 130 210 150",
					"主炮 100 130 210 30",
					"萝卜 10 90 90 30",
					"飞龙 30 60 10 130"
				});
				if (!(a == "通用 100 130 210 150"))
				{
					if (!(a == "主炮 100 130 210 30"))
					{
						if (!(a == "萝卜 10 90 90 30"))
						{
							if (a == "飞龙 30 60 10 130")
							{
								this.Game.OthersConfig.EquipmentOil = 30;
								this.Game.OthersConfig.EquipmentAmmo = 60;
								this.Game.OthersConfig.EquipmentSteel = 10;
								this.Game.OthersConfig.EquipmentAluminium = 130;
							}
						}
						else
						{
							this.Game.OthersConfig.EquipmentOil = 10;
							this.Game.OthersConfig.EquipmentAmmo = 90;
							this.Game.OthersConfig.EquipmentSteel = 90;
							this.Game.OthersConfig.EquipmentAluminium = 30;
						}
					}
					else
					{
						this.Game.OthersConfig.EquipmentOil = 100;
						this.Game.OthersConfig.EquipmentAmmo = 130;
						this.Game.OthersConfig.EquipmentSteel = 210;
						this.Game.OthersConfig.EquipmentAluminium = 30;
					}
				}
				else
				{
					this.Game.OthersConfig.EquipmentOil = 100;
					this.Game.OthersConfig.EquipmentAmmo = 130;
					this.Game.OthersConfig.EquipmentSteel = 210;
					this.Game.OthersConfig.EquipmentAluminium = 150;
				}
			});
		}

		// Token: 0x06000335 RID: 821 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatedFrom(INavigationParameters parameters)
		{
		}

		// Token: 0x06000336 RID: 822 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatedTo(INavigationParameters parameters)
		{
		}

		// Token: 0x06000337 RID: 823 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatingTo(INavigationParameters parameters)
		{
		}
	}
}
